<!--
 * @Author: huangpx
 * @Date: 2023-04-22 14:58:05
 * @LastEditors: huangpx
 * @LastEditTime: 2023-06-26 15:05:55
 * @Description: file content
-->
<template>
    <div>
        <!-- <h1>基础用法</h1>
        <ff-tree :data="data"/>
        <h1>可选择</h1>
        <ff-tree :data="data" show-checkbox  @check-change="handleCheckChange"/>
     <h1>懒加载</h1> -->
      <ff-tree :props="props"
        :load="loadNode"
        lazy
         highlight-current
        show-checkbox
        />
        <div @click="skip()">跳转测试2</div>
    </div>
</template>
<script>
  export default {
    data() {
      return {
        props: {
          label: 'name',
          children: 'zones',
          isLeaf: 'leaf'
        },
      };
    },
    methods: {
        skip(){
            this.$router.push({ path: '/test3',query: { skipUrl: true } });
        },
       loadNode(node, resolve) {
        if (node.level === 0) {
          return resolve([{ name: 'region' }]);
        }
        if (node.level > 1) return resolve([]);
        setTimeout(() => {
          const data = [{
            name: 'leaf',
          }, {
            name: 'zone'
          }];
          resolve(data);
        }, 500);
      }
    }
  };
</script>